// API响应基础类型
export interface ApiResponse<T = any> {
  success: boolean
  message?: string
  data?: T
  errors?: any
  code?: number
}

// 分页响应类型
export interface PaginatedResponse<T> {
  results: T[]
  total: number
  page: number
  page_size: number
  total_pages: number
  has_next: boolean
  has_previous: boolean
}

// 用户相关类型
export interface User {
  id: number
  username: string
  email: string
  first_name?: string
  last_name?: string
  phone?: string
  avatar?: string
  is_active: boolean
  is_staff: boolean
  date_joined: string
  roles: Role[]
  permissions: Permission[]
}

// 角色类型
export interface Role {
  id: number
  name: string
  code: string
  description?: string
  permissions: Permission[]
  is_active: boolean
  created_at: string
  updated_at: string
}

// 权限类型
export interface Permission {
  id: number
  name: string
  code: string
  description?: string
  created_at: string
  updated_at: string
}

// 菜单类型
export interface Menu {
  id: number
  name: string
  path: string
  component?: string
  icon?: string
  parent?: number
  sort_order: number
  is_active: boolean
  permissions: Permission[]
  children?: Menu[]
  created_at: string
  updated_at: string
}

// 请求参数类型
export interface LoginRequest {
  username: string
  password: string
}

export interface RegisterRequest {
  username: string
  email: string
  password: string
  password_confirm: string
  phone?: string
}

// 分页参数
export interface PaginationParams {
  page?: number
  page_size?: number
}

// 搜索参数
export interface SearchParams extends PaginationParams {
  search?: string
  ordering?: string
}

// 角色搜索参数
export interface RoleSearchParams extends SearchParams {
  name?: string
  is_active?: boolean
}

// 用户搜索参数
export interface UserSearchParams extends SearchParams {
  username?: string
  email?: string
  is_active?: boolean
  is_staff?: boolean
}
